<?php if ($sf_user->hasFlash('flash_message')){
?>		
			<div id="notification" class="nNote nSuccess hideit" onclick="$('#notification').hide('slow')" style="margin-top: 20px;">
                <p><strong>SUCCESS: </strong> <?php echo $sf_user->getFlash('flash_message') ?></p>
         </div>

<?php 
}?>

<div class="widget" id="template_div">
        <div class="head"><h5 class="iList">Download XLS</h5></div>
        <form action="<?php echo url_for("excel_processing/downloadDirectory")?>" method="post" id="getXls_form">
            <fieldset>
            
		     	<div class="rowElem noborder">
		     		<div class="formLeft">
							<select id="sl_master_directory" name="sl_master_directory" >
							<option value="">
                    		--Select--
                    		</option>                    	
                    		<?php 
                    		foreach($directories as $directory){
                    			if (count($directory->getCategory()) > 0){
                    			?>
                    		<option value="<?php echo $directory->getId()?>">
                    			<?php echo $directory->getName()?>
                    		</option>	
                    		<?php 
                    			}
                    			
                    		}
                    		?>
                    	</select>		     		
		     		</div>
		     		 
		     			<div id="generate_btn" style="float:left; margin-left: 20px; margin-top: -5px;">
							<input type="button" value="Download xls" id="download_xls">
						</div>
		     		 
		     		<div class="fix"></div>
		     		
		     		
		     	</div>            
 
            </fieldset>
	</form>
</div>


<div class="widget" id="template_div">
        <div class="head"><h5 class="iList">Upload XLS</h5></div>
        <form action="<?php echo url_for("excel_processing/uploadDirectory")?>" method="post" id="uploadXls_form" enctype="multipart/form-data">
            <fieldset>
            
		     	<div class="rowElem noborder">
		     		<div class="formLeft">
						<div style="float: left; width: 570px">
							<label>XLS Path :</label> 
						     <div style="margin-top: 10px">
						          <input type="file" id="csv_file" class="fileInput" id="fileInput" name="fileInput" />
						     </div>			
						</div>							     		
		     		</div>
		     		 
		     			<div id="upload_btn" style="float:left; margin-left: -120px;  margin-top: 28px;">
							<input type="button" value="Upload xls" id="upload_xls">
						</div>
		     		 
		     		<div class="fix"></div>
		     		
		     		
		     	</div>            
 
            </fieldset>
	</form>
</div>

<script>

$("#download_xls").click(function (event){
	
	if (document.getElementById("sl_master_directory").value != ""){
		$("form#getXls_form").submit();
    }
})


$("#upload_xls").click(function (event){
	
	if (document.getElementById("csv_file").value != ""){
		$("form#uploadXls_form").submit();
    }
})


</script>